/******************************

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <iostream>
//for setw, precision()
#include <iomanip>
using namespace std;

class Date{
	int d, m, y;
public:
	Date(){};
	Date(int d, int m, int y){
		this->d = d;
		this->m = m;
		this->y = y;
	}
	void input(){
	cout<<"Enter d m y: ";

	cin>>d>>m>>y;
	}
	bool isLeap(){
		return ((y%4==0)&&(y%100 !=0) || y%400==0) ?1:0;
	}
	int dateOfYear(){
		return (isLeap())?366:365;
	}
	int dateOfYear(int n){
		Date d;
		d.y = n;
		return d.dateOfYear();
	}
	int dateOfMonth(){
		int a[] = {31,28,31,30,31,30,31,31,30,31,30,31};
		a[1] = isLeap() ? 29:28;
		return a[m-1];
	}

	void incDay(){
		if (++d > dateOfMonth())
		{
			d = 1;
			if (++m > 12)
			{
				m =1;
				y++;
			}
		}
	}
	void decDay(){
		if (--d ==  0)
		{
			if (--m == 0)
			{
				y--;
				m = 12;
			}
		}
		d= dateOfMonth();

	}
	void show(){
		cout << "\nDisplay:\n"<<d<<" "<<m<<" "<<y;
	}
};

class Time{
	int h,m,s;
public:
	Time(){
		h = m = s = 0;
	}
	void input(){
		cout<<"\nEnter h m s: ";
		cin>>h>>m>>s;
	}
	void incSec(){
		if (++s >59)
		{
			s=1;
			if (++m >59)
			{
				m = 0;
				if (++h >23)
				{
					h = 0;
				}
			}
		}
	}
	void decSec(){
		if (--s <0)
		{
			s = 59;
			if (--m<0)
			{
				m = 59;
				if (--h <0)
				{
					h  = 23;
				}
			}
		}
	}
	void show(){
		cout<<"\n"<<h<<" "<<m<<" "<<s;
	}
};

void testDate(){
	Date d ;
	d.input();
	//d.incDay();
	d.decDay();
	d.show();
	getch();
}
void testSec(){
		Time t;
		t.input();
		t.decSec();
		t.show();
		getch();
}
void main(){
	while (true)
	{
		testDate();
	}

	getch();
}

/**********************************/